/*************************************************************************
	> File Name: p1443_2.cpp
	> Author: zhangxu 
	> Mail: walrus1983@126.com
	> Created Time: 五  8/30 21:25:13 2024
 ************************************************************************/

#include <cstdio>
#include <queue>
using namespace std;
#define MAX_N 400

int dir[8][2] = {{ 2,  1},
 				 { 1,  2},
  				 {-1, -2},
				 {-2, -1},
				 { 1, -2},
				 {-1,  2},
				 {-2,  1},
				 { 2, -1}
  };
int dis[MAX_N + 5][MAX_N + 5];

struct Point{
	Point(int x, int y, int s) : x(x), y(y), s(s) {}
	int x, y, s;
} ;


void bfs(int n, int m, int x, int y) {
	queue<Point> q;
	q.push(Point(x, y ,0));
	dis[x][y] = 0;
	while(!q.empty()) {
		Point cur = q.front();
		q.pop();
		for(int k = 0; k < 8; k++) {
			int dx = cur.x + dir[k][0];
			int dy = cur.y + dir[k][1];
			if(dx < 1 || dx > n) continue ;
			if(dy < 1 || dy > m) continue ;
			if(dis[dx][dy] != -1) continue ;
			q.push(Point(dx, dy, cur.s + 1));
			dis[dx][dy] = cur.s + 1;
		}
	}
	return ;
}

int main() {
	int n, m, x, y;
	scanf("%d%d%d%d", &n,&m, &x, &y);
	for(int i = 1; i <= n; i++) {
		for(int j = 1; j <= m; j++) {
			dis[i][j] = -1;
		}
	}
	bfs(n, m, x, y);
	for(int i = 1; i <= n; i++) {
		for(int j = 1; j <= m; j++) {
			if(j > 1) printf(" ");
			printf("%d", dis[i][j]);
		}
		printf("\n");
	}
	return 0;
}